package by.alex.dzeshko.lastfmsimple.appstate;

import android.support.v4.app.Fragment;
import by.alex.dzeshko.lastfmsimple.app.fragment.AlbumsListFragment;
import by.alex.dzeshko.lastfmsimple.app.fragment.ArtistListFragment;
import by.alex.dzeshko.lastfmsimple.app.fragment.TrackListFragment;

public class AppState {

	private static AppState instance;

	private AppState() {

	}
	
	public static AppState getInstance() {
		if (instance == null)
			instance = new AppState();
		return instance;
	}

	public static enum ScreenState {
		ALBUM, ARTIST, TRACK
	};

	private ScreenState mCurrentState;

	private boolean mLoadingId;
	
	public ScreenState getCurrentState() {
		return mCurrentState;
	}

	public void setCurrentState(ScreenState mCurrentState) {
		this.mCurrentState = mCurrentState;
	}

	public boolean isLoadingId() {
		return mLoadingId;
	}

	public void isLoadingId(boolean mLoadingId) {
		this.mLoadingId = mLoadingId;
	}

	public static Fragment getFragment(ScreenState state) {
		switch (state) {
		case ALBUM:
			return new AlbumsListFragment();
		case ARTIST:
			return new ArtistListFragment();
		case TRACK:
			return new TrackListFragment();
		}
		return null;
	}
}
